package categories;

import java.util.HashMap;
import java.util.Map;

/**
 * Copyright (c) 2007 Vogster Intertaiment, Inc. All rights reserved.
 *
 * $Id:
 */

public enum CustomerCategory {
    White("w"), Black("b"), Uncategorised("u");

    private final String abbrevated;
    private final static Map<String, CustomerCategory> idx2cat;

    static {
        idx2cat = new HashMap<String, CustomerCategory>(CustomerCategory.values().length);
        for(CustomerCategory category : CustomerCategory.values()) {
            idx2cat.put(category.abbrevated, category);
        }
    }

    CustomerCategory(String abbrevated) {
        this.abbrevated = abbrevated;
    }

    public Integer getIdx() {
        return this.ordinal();
    }

    public static CustomerCategory valueOfAbbrevated(String abbrevated) {
        return idx2cat.get(abbrevated);
    }
}
